package com.example.administrator.historytoday;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.webkit.WebView;
import android.webkit.WebViewClient;

public class ArticleActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_article);
        //隐藏标题
        if(getSupportActionBar()!=null) {
            //getSupportActionBar().hide();
        }

        Intent intent = getIntent();
        String title = intent.getStringExtra("title");

        WebView webView = findViewById(R.id.webView);
        //百度
        //String url = "https://baike.baidu.com/search/word?word="+title;
        String url = "https://baike.baidu.com/item/"+title;
        //维基百科
        //String url = "https://zh.m.wikipedia.org/wiki/"+title;
        webView.loadUrl(url);
        webView.getSettings().setJavaScriptEnabled(true);
        webView.setWebViewClient(new WebViewClient());
    }
}
